home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / src / emog.lha / emog.e < prev    next >
Encoding:
Text File  |  2000-03-07  |  2.5 KB  |  84 lines

  1. /* -- ----------------------------------------------------- -- *
  2.  * -- Name........: emog.e                                  -- *
  3.  * -- Description.: Main part of the converter.             -- *
  4.  * -- Author......: Daniel Kasmeroglu                       -- *
  5.  * -- E-Mail......: raptor@cs.tu-berlin.de                  -- *
  6.  * --               daniel.kasmeroglu@daimlerchrysler.com   -- *
  7.  * -- Date........: 07-Mar-00                               -- *
  8.  * -- Version.....: 0.1                                     -- *
  9.  * -- ----------------------------------------------------- -- */
  10.  
  11. /* -- ----------------------------------------------------- -- *
  12.  * --                          Options                      -- *
  13.  * -- ----------------------------------------------------- -- */
  14.  
  15. OPT LARGE
  16.  
  17.  
  18. /* -- ----------------------------------------------------- -- *
  19.  * --                          Modules                      -- *
  20.  * -- ----------------------------------------------------- -- */
  21.  
  22. MODULE  '*scanner' ,
  23.     '*parser'  ,
  24.     '*egen'
  25.  
  26.  
  27. /* -- ----------------------------------------------------- -- *
  28.  * --                            Main                       -- *
  29.  * -- ----------------------------------------------------- -- */
  30.  
  31. PROC main() HANDLE
  32. DEF ma_tempout [20] : STRING
  33. DEF ma_args         : PTR TO LONG
  34. DEF ma_rdargs, ma_absy, ma_output
  35.  
  36.   WriteF( 'EMOG - E Module Generator (2000)\n' )
  37.   WriteF( '(c) Written by Daniel Kasmeroglu\n' )
  38.  
  39.   ma_args   := [ NIL, NIL ]
  40.   ma_rdargs := ReadArgs( 'SOURCE/A,DEST/A', ma_args, NIL )
  41.   IF ma_rdargs = NIL
  42.     WriteF( 'No args !\n' )
  43.   ELSE
  44.  
  45.     -> Do the scanning stuff and parse the tokens
  46.     scan( ma_args[0], ma_tempout )
  47.     ma_absy   := parse( ma_tempout )
  48.  
  49.     -> Open the output file and throw the generated code in it.
  50.     ma_output := Open( ma_args[1], NEWFILE )
  51.     IF ma_output <> NIL
  52.  
  53.       -> Generate E module source.
  54.       -> Here we can introduce alternative generators ;-)
  55.       generateE( ma_absy, ma_args[0], ma_output )
  56.  
  57.       Close( ma_output )
  58.  
  59.     ELSE
  60.       WriteF( 'Cannot open destination file !\n' )
  61.     ENDIF
  62.  
  63.     FreeArgs( ma_rdargs )
  64.  
  65.   ENDIF
  66.  
  67. EXCEPT
  68.  
  69.   SELECT exception
  70.   CASE "SCAN" ; WriteF( 'Error during scanning !\n' )
  71.   CASE "PARS" ; WriteF( 'Error during parsing !\n'  )
  72.   ENDSELECT
  73.  
  74. ENDPROC
  75.  
  76.  
  77. /* -- ----------------------------------------------------- -- *
  78.  * --                           Data                        -- *
  79.  * -- ----------------------------------------------------- -- */
  80.  
  81. lab_version:
  82. CHAR '$VER: EMOG 0.1 26-Feb-00', 0
  83.  
  84.